package com.atiguigu.spring6.validator.two;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestDemo {

    @Test
    public void testValidator() {
        User user = new User();
        user.setName("张三");
        user.setAge(20);
        user.setEmail("zhangsan@atguigu.com");
        user.setMessage("你 好");

        ApplicationContext context = new  AnnotationConfigApplicationContext(ValidationConfig.class);
        MyValidation1 myValidation1 = context.getBean(MyValidation1.class);
        boolean b = myValidation1.validatorByUser(user);
        System.out.println(b);

//        MyValidation2 myValidation2 = context.getBean(MyValidation2.class);
//        boolean b1 = myValidation2.validatorByUser(user);
//        System.out.println(b1);
    }
}
